<<<<<<< HEAD
<?php
if (! defined ( 'BASEPATH' ))
    exit ( 'No direct script access allowed' );
class user_center extends CI_Controller {
    public function __construct() {
        parent::__construct ();
    }
    
    /**
     * 对外校验access_token
     */
    public function index() {
        $mer_id = $this->input->post ( "MerId" );
        $access_token = $this->input->post ( "AccessToken" );
        $open_id = $this->input->post ( "OpenId" );
        $enc_string = $this->input->post ( "EncString" );
        
        $this->load->library ( "/user/sdk_user" );
        
        $result = $this->sdk_user->check_user_access_token ( $mer_id, $open_id, $access_token, $enc_string );
        
        echo json_encode ( $result );
    }
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class user_center extends CI_Controller {
	public function __construct() {
		parent::__construct();
	}

	/**
	 *
	 * 登录校验
	 */
	public function index() {
		$mer_id 	=$this->input->post("MerId");
		$act 		=$this->input->post("Act");
		$uin 		=$this->input->post("Uin");
		$session_key =$this->input->post("SessionKey");
		$enc_string	=$this->input->post("EncString");
		$this->load->model("mpay_merchant_model");
		$mer_key	=$this->mpay_merchant_model->query_merchant_key($mer_id);
		if ($mer_key==null) {
			$result['ErrorCode'] =2;
			$result['ErrorDesc'] ="AppId无效";
			echo json_encode($result);
			exit();
		}
		/**
		 *
		 * 校验规则,md5(商户编号,act,用户帐号,sessionkey,密钥 )
		 */
		$local_sign	=md5($mer_id.$act.$uin.$session_key.$mer_key);
		if ($local_sign!=$enc_string) {
			$result['ErrorCode'] = 5;
			$result['ErrorDesc'] = "Sign无效";
			echo json_encode($result);
			exit();
		}


		$result['ErrorCode'] = 1;
		$result['ErrorDesc'] ="成功";
		echo json_encode($result);
	}

	public function registry(){
		$data['account'] =$this->input->post("account");
		$data['password']  =$this->input->post("password");
		$data['device_ime'] =$this->input->post("device_imei");
		$data['mer_id']	=$this->input->post("mer_id");
		$need_login =$this->input->post("need_login");
		$this->load->library("sws_user");
		$result =	$this->sws_user->registry($data,$need_login);
		echo json_encode($result);
	
	}
>>>>>>> ea7778062921d95d2d30cfd0d4a3428a8dd97285
}